package com.xuetang9.t9.hotel.mapper;

import com.xuetang9.t9.hotel.beans.RoomPhoto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author Pang
 */
public interface IRoomPhotoMapper {

    /**
     * 根据房间编号来查询房间照片路径
     * @param id
     * @return
     */
    @Select("SELECT * FROM g_roomphoto WHERE room_id=#{id}")
    RoomPhoto selectByRoomId(Integer id);

    /**
     * 更新
     * @param roomPhoto
     * @return
     */
    @Update("UPDATE g_roomphoto SET room_id=#{roomId},phtot_master=#{phtotMaster},phtot_guest=#{phtotGuest},phtot_toilet=#{phtotToilet} WHERE photo_id=#{photoId}")
    int updata(RoomPhoto roomPhoto);


    /**
     * 根据照片编号删除
     * @param id
     * @return
     */
    @Delete("DELETE FROM g_roomphoto WHERE photo_id=#{ID}")
    int deleteByPhotoId(Integer id);

    /**
     * 根据房间编号删除
     * @param id
     * @return
     */
    @Delete("DELETE FROM g_roomphoto WHERE room_id=#{ID}")
    int deleteByRoomId(Integer id);


    /**
     * 添加
     * @param roomPhoto
     * @return
     */
    @Insert("INSERT INTO g_roomphoto VALUES(#{photoId},#{roomId},#{phtotMaster},#{phtotGuest},#{phtotToilet}")
    int insert(RoomPhoto roomPhoto);
}
